/**
 * Copyright (c) 2011-9-23 WKM and/or its affiliates. 
 * Use is subject to license terms.
 * All rights reserved.
 */
package org.wkm.task;

import java.awt.AWTException;
import java.awt.SystemTray;
import java.io.File;

import javax.swing.UIManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wkm.definition.SystemTrayTest;
import org.wkm.util.SystemUtil;

import com.birosoft.liquid.LiquidLookAndFeel;

/**
 * @author WKM
 * Modification history
 * 1.WKM -2011-9-23-Create File
 */
public class Main {

	/** 日志信息 **/
	private static Logger logger = LoggerFactory.getLogger(Main.class);
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		logger.info("准备启动...");
		try{
			
			if(args == null){
				System.setProperty("wkm.home", System.getProperty("user.dir") + File.separator + "bin");
			}
			if(args.length == 0){
				System.setProperty("wkm.home", System.getProperty("user.dir") + File.separator + "bin");
			}
			if(args.length > 0){
				System.setProperty("wkm.home", args[0]);
			}
			
			logger.info("设置软件运行的根目录:" + System.getProperty("wkm.home"));
			
			UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");//Windows外观
			logger.info("加载外观：com.birosoft.liquid.LiquidLookAndFeel");
			LiquidLookAndFeel.setLiquidDecorations(true,"mac");
			logger.info("设置为苹果：mac");
			
			if(SystemTray.isSupported()){
				new SystemTrayTest().test();
			}
			
			if(SystemUtil.isLinux()) {
				logger.info("开发中...");
			}
		} catch (AWTException e) {
			// TODO: handle exception
			e.printStackTrace();
			logger.info("托盘启动失败:" + e.getMessage());
		}  catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			logger.error("不支持外观：com.birosoft.liquid.LiquidLookAndFeel");
		}
//		new Start().start();
		logger.info("启动完成！");
	}

}
